/*
 * PoreGasConvectionKernel.C
 *
 *  Created on: 2017年7月24日
 *      Author: liuxiao
 */


#include "../../include/kernels/PorePressureDiffusionKernel.h"

registerMooseObject("TrilobitaApp", PorePressureDiffusionKernel);
template<>
InputParameters validParams<PorePressureDiffusionKernel>()
{
  InputParameters params = validParams<Kernel>();
  params.addClassDescription("Compute heat conductivity kernel ");
  params.addRequiredCoupledVar("temperature", "Coupled Temperature");
  return params;
}

PorePressureDiffusionKernel::PorePressureDiffusionKernel(const InputParameters & parameters) :
  Kernel(parameters),
  _permeability(getMaterialProperty<Real>("permeability")),
  _viscosity(getMaterialProperty<Real>("viscosity")),
  _R(getMaterialProperty<Real>("gas_constant")),
  _temperature(coupledValue("temperature"))
//  _P(getMaterialProperty<Real>("PP"))
{
}

Real PorePressureDiffusionKernel::computeQpResidual()
{
//	std::cout << _k[_qp] <<std::endl;

  Real r(0);
  Real coff = _permeability[_qp]*_u[_qp]/_viscosity[_qp]/_R[_qp]/_temperature[_qp];
  r = coff*_grad_u[_qp] * _grad_test[_i][_qp];
  return r;
}

Real PorePressureDiffusionKernel::computeQpJacobian()
{
  Real jac(0);
  Real coff = _permeability[_qp]*_u[_qp]/_viscosity[_qp]/_R[_qp]/_temperature[_qp];
  jac = coff*_grad_phi[_j][_qp] * _grad_test[_i][_qp];
//  jac += _grad_u[_qp] * _grad_test[_i][_qp]*_k_dT[_qp]*_phi[_j][_qp];
  return jac;
}
